<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="com.vince.model.domain.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
 .one ul li{
  display: inline-block;
 }
</style>
<script type="text/javascript">

 function checkNull(){
	 if(form1.name.value==null||form1.name.value==""){
		 alert("订单名称不能为空，请输入");
		 form1.name.focus();
		 return false;
	 }
	
	 if(form1.deliverymethod.value==null||form1.deliverymethod.value==""){
		 alert("发货方式不能为空，请输入");
		 form1.deliverymethod.focus();
		 return false;
		 
	 }

	
 }
  
</script>
</head>
<body>
    <div >
    <h2>查询</h2>
    <form action="<%=request.getContextPath()%>/servlet/orderservlet?method=search" method="post"  name="form2">
     <input type="date" name="begin"/> 至
     <input type="date" name="end"/>
     <input type="submit" value="查找">
    </form>
    </div>

<!-- 从request对象获取查询出的订单列表 -->
     <div class="one">
     <h2>用户订单列表</h2>
      <ul class="list-header">
        <li class="cloumn01">订单id</li>
        <li class="cloumn02">订单名称</li>
        <li class="cloumn07">订单总金额</li>
        <li class="cloumn07">发货方式</li>
        <li class="cloumn04">上次更新时间</li>
        <li class="cloumn05">创建时间</li>
     </ul>
    
     <c:forEach var="list" items="${requestScope.orderlist}">
     <ul class="list-header">
        <li class="cloumn01">${list.orderId}</li>
        <li class="cloumn02">${list.orderCode}</li>
        <li class="cloumn07">${list.sum}</li>
        <li class="cloumn04">${list.deliveryMethod}</li>
        <li class="cloumn05">${list.lastModifyDate}</li>
        <li class="cloumn05">${list.lastModifyDate}</li>
        <li>
         <form action="<%=request.getContextPath()%>/servlet/itemsservlet?method=list&orderid=${list.orderId}" method='post' >
          <input type="submit" value="查看订单详情">
         </form>
        </li> 
        <li>
         <form action="<%=request.getContextPath() %>/servlet/orderservlet?method=delete&orderid=${list.orderId}" method="post" name="form3">
          <input type="submit" value="删除" name="delete">
         </form>
        </li>
     </ul>
     </c:forEach>
     
     </div>
   
       <div>
		 <h2>添加订单</h2>
		 <form action="<%=request.getContextPath() %>/servlet/orderservlet?method=add" name="form1"  onsubmit="return checkNull()" method="post">
			  订单名称<input type="text" name="name"><span>*</span>
			  订单总金额<input type="text" name="sum">
			  发货方式<input type="text" name="deliverymethod"><span>*</span>
			  <input type="submit" value="增加">
			  <input type="reset" value="重置">
		 </form>
	   </div>
	   <div>
	    <h2>退出系统</h2>
	    <input type="submit" onclick="document.location.href='<%=request.getContextPath()%>/servlet/logoutservlet'" value="退出系统">
	   </div>
</body>
</html>